package com.topka.buynewcar.android.pages;

import java.util.List;

import org.openqa.selenium.WebElement;

import io.appium.java_client.android.AndroidDriver;

import com.topka.buynewcar.base.BasePage;
import com.topka.buynewcar.utils.DeviceInfo;

public class ChooseCarTypePage extends BasePage {

	public ChooseCarTypePage(AndroidDriver wd) {
		super(wd);
	}
	
	public void clickCarTypeRandom(){
		int width = DeviceInfo.getWidth(wd);
		int height = DeviceInfo.getHeight(wd);
		int count = (int) (Math.random()*5);
		for (int i = 0; i < count; i++) {
			wd.swipe(width/2,height*3/4, width/2,height/4, 1000);
		}
		List<WebElement> list = findViewsById("car_type_name");
		int index = (int) (Math.random()*list.size());
		list.get(index).click();
	}

}
